package com.chamberlain.web.controller.mqtt;

import com.alibaba.fastjson2.JSON;
import com.chamberlain.common.annotation.Anonymous;
import com.chamberlain.common.core.domain.AjaxResult;
import com.chamberlain.common.core.domain.entity.Equipment;
import com.chamberlain.equipment.mqtt.MqttPublishClient;
import com.chamberlain.equipment.service.IEquipmentService;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.spring.web.json.Json;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author: CYY
 * @date: 2024/4/5
 */
@RestController
@RequestMapping("/mqtt")
public class MqttController {


    @Autowired
    private IEquipmentService equipmentService;

    @Anonymous
    @PostMapping("/changeDisjunctionByMac")
    public AjaxResult changeDisjunctionByMac(@RequestBody Equipment equipment){
        System.out.println(equipment);
        equipmentService.updateEquipmentByMac(equipment);
        return AjaxResult.success();
    }
}
